package com.linqi.freebie.repo

import com.linqi.freebie.http.DoHttp
import com.linqi.freebie.http.ktorClientCio.response.ResponseHolder


/**
 * @auth: Dim
 * 邮箱: 707638223@qq.com
 * 创建时间: 2025/7/18
 * 描述:
 */
class NetRepoImpl : NetRepo {

    override suspend fun checkRateLimit(): ResponseHolder<String> {
        return DoHttp.getInstance().get(
            url = "rate_limit",
            isInfoResponse = false
        )
    }


    /**
     * 获取最新的仓库信息
     */
    override suspend fun getLatestRepoInfo(
        repo: String,
        appId: String
    ): ResponseHolder<String> {
        return DoHttp.getInstance().get(
            url = "repos/$repo/branches/$appId",
            isInfoResponse = false
        )
    }

    override suspend fun getStringResultByUrl(url:String): ResponseHolder<String> {
        return DoHttp.getInstance().get(
            url = url,
            isInfoResponse = false
        )
    }

    override suspend fun fetchFileContent(url:String): ResponseHolder<ByteArray> {
        return DoHttp.getInstance().get(
            url = url,
            isInfoResponse = false
        )
    }


}